package com.whstudio.activity.research;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class ActivityTables {
	private static final String BUNDLE_NAME = "activity_tables"; //$NON-NLS-1$

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

	private ActivityTables() {
		
	}

	public static String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
	
	public final static Map<String,String> getKeyValue(){
		Map<String, String> map=new HashMap<String, String>();
		Enumeration<String> keys=RESOURCE_BUNDLE.getKeys();
		while (keys.hasMoreElements()) {
			String key =  keys.nextElement();
			String value=RESOURCE_BUNDLE.getString(key);
			System.out.println(key+':'+RESOURCE_BUNDLE.getString(key));
			map.put(key, value);
		}
		return map;
	}
	
	public final static List<String> getValues(){
		List<String> values=new ArrayList<String>();
		Enumeration<String> keys=RESOURCE_BUNDLE.getKeys();
		while (keys.hasMoreElements()) {
			String key =  keys.nextElement();
			String value=RESOURCE_BUNDLE.getString(key);
			values.add(value);
		}
		return values;
	}
	
	public final static String [] getValueArray(){
		List<String> valueList=getValues();
		String [] myArray=new String[valueList.size()];
		return valueList.toArray(myArray);
	}
}
